1. Field of the Invention
Embodiments of the invention relate to naming. More specifically, embodiments relate to accessing factories in the naming system.
2. Background
Naming service broadly refers to the mechanism by which an object is associated with a name and by which objects may be found given their names. Each name is generated by a set of syntactic rules called, “naming convention.” An atomic name is an indivisible component of a name as defined by the naming convention. The association of the atomic name with an object is called, “binding.” Some objects cannot be stored directly so they are put in the system as references. A “reference” is an object, which contains one or some addresses of objects which themselves are not directly bound to the naming system. Every name is interpreted relative to some context, and every naming operation is performed in a context object. A “context” is a set of bindings in which names are relative to a certain naming convention. A client may obtain an initial context object that provides a starting point for resolution of names in the naming system. Every naming system consists of contexts of a certain type (one and the same naming convention) that provide the same identical set of operations. Every operation is relative to a certain namespace. A “namespace” is the set of names in the naming system. The naming service organization of the namespace is a treelike structure of naming context objects that can be traversed to locate a particular name.
A directory service is a naming service that allows each bound object to be associated with attributes and provides a way to retrieve an object by looking up some of its attributes rather than its name (search). The “attributes” are object characteristics. Both the attributes and the object itself form a directory object. A “directory” is a linked set of directory objects.
In a Java context, basic support for the naming and directory service is provided by a Java Naming and Directory Interface (JNDI) such as specified in JNDI: Java Naming and Directory Interface, Version 1.2, published by Sun Microsystems of Mountain View, Calif. and subsequent revisions thereof (the JNDI Specification). The JNDI Specification meets the system requirements of Java 2 Enterprise Edition (J2EE). These requirements are defined in the Java 2 Enterprise Edition Specification 1.3, published Jul. 27, 2001 or subsequent versions thereof (the J2EE Standard). JNDI is defined to be independent of any specific directory service implementation. This permits a variety of directories to be accessed in a common way.
Using standard JNDI it is difficult to customize implementations of initial context factories, object factories, uniform resource locator (URL) factories, and state factories. In some cases, it is desirable to permit a client to register and use its own implementations of such factories. Unfortunately, in existing systems, if such implementations are not available in the class path of a client, this is not possible. This issue arises in the context of classloading. A “class loader” can create a new instance of a class from the class name. Each component in a typical system may have its own class loader that can load one or more classes. Unfortunately, if the class name of a given factory is not among those in a particular class loader, the loader cannot load a new instance of this factory class. Typically, the naming service provider provides several implementations of different factories so that the client's developer can read in the documentation the benefit of each factory and to choose which one to use. Then the client merely specifies the class name of the chosen factory in the environment properties and the role of the classloader is to load a new instance of this class by given class name. By default only a single InitialContextFactoryBuilder and ObjectFactoryBuilder implementation can be registered in javax.naming.spi.NamingManager object of a certain virtual machine (VM).